<!DOCTYPE html>
<html class="x-admin-sm">

{include file="common/static" /}
{include file="common/resources" /}
<body>
<div class="x-nav">
            <span class="layui-breadcrumb">
                <a href="">首页</a>
                <a href="">演示</a>
                <a>
                    <cite>导航元素</cite></a>
            </span>
    <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right" onclick="location.reload()" title="刷新">
        <i class="layui-icon layui-icon-refresh" style="line-height:30px"></i>
    </a>
</div>

<div class="layui-fluid">
    <div class="layui-col-md12">
        <div class="layui-card">
            <div class="layui-card-header">普通用户</div>
            <div class="layui-card-body ">
                <table class="layui-table">
                    <tbody>
                    <tr>
                        <th>客户离店超时可以宽限
                            <div class="layui-form layui-input-inline layui-show-xs-block">
                                <select name="shipping" class="valid" id="overtime">
                                    <option value="{$list.overtime}">{$list.overtime}</option>
                                    <option value="10">10</option>
                                    <option value="20">20</option>
                                    <option value="30">30</option>
                                    <option value="40">40</option>
                                    <option value="50">50</option>
                                    <option value="60">60</option>
                                </select>
                            </div>
                            分钟
                        </th>
                        <td>客户退房时间

                            <div class="layui-input-inline layui-show-xs-block">
                                <input type="text" name="username" placeholder="请输入时间" autocomplete="off" class="layui-input" value="{$list.check_out}" id="check_out">
                            </div>
                            点
                        </td>
                    </tr>

                    <tr>
                        <th>离店时间超过退房时间加收全天房价*
                            <div class="layui-form layui-input-inline layui-show-xs-block">
                                <select name="shipping" class="valid" id="exceed">
                                    <option value="{$list.exceed}">{$list.exceed}</option>
                                    <option value="0.1">0.1</option>
                                    <option value="0.2">0.2</option>
                                    <option value="0.3">0.3</option>
                                    <option value="0.4">0.4</option>
                                    <option value="0.5">0.5</option>
                                </select>
                            </div>
                        </th>
                        <th>
                            离店时间在
                            <div class="layui-input-inline layui-show-xs-block">
                                <input type="text" name="username" placeholder="请输入时间" autocomplete="off" class="layui-input" value="{$list.leave}" id="leave">
                            </div>
                            点以后
                            直接加收一天费用

                            <div class="layui-form layui-input-inline layui-show-xs-block">
                                <select name="shipping" class="valid" id="additional">
                                    <option value="{$list.additional}">{$list.additional}</option>
                                    <option value="0.1">0.1</option>
                                    <option value="0.2">0.2</option>
                                    <option value="0.3">0.3</option>
                                    <option value="0.4">0.4</option>
                                    <option value="0.5">0.5</option>
                                </select>
                            </div>
                        </th>

                    </tr>

                    </tbody>
                </table>
                <button class="layui-btn"  value="保存设置" onclick="edits({$list.id})">保存设置
            </div>
        </div>
    </div>
</div>

</body>

<script>
    layui.use(['form', 'layer'],
        function() {
            $ = layui.jquery;
            var form = layui.form,
                layer = layui.layer;
        });
    layui.use(['laydate', 'form'],
        function() {
            var laydate = layui.laydate;

            //执行一个laydate实例
            laydate.render({
                elem: '#start' //指定元素
            });

            //执行一个laydate实例
            laydate.render({
                elem: '#end' //指定元素
            });
        });

    function edits(id){
        $.ajax({
            type:"post",
            url: "{:url('home/charges/edits')}",
            data: {
                id:id,
                overtime:$('#overtime').val(),
                check_out:$('#check_out').val(),
                exceed:$('#exceed').val(),
                leave:$('#leave').val(),
                additional:$('#additional').val(),
            },
            success: function(data){
                console.log(data);
                toastr.error(data.msg);
                if(data.code == 100){
                    setTimeout(function () {
                        layer.closeAll();
                        parent.location.reload();
                    },1500);
                }
            }});
    }

</script>


</html>